package v1

import (
	"fmt"
	"server/model"
	"server/model/response"
	"server/service"
	"github.com/gin-gonic/gin"
)

func JsonInBlacklist(c *gin.Context) {
	token := c.Request.Header.Get("X-Auth-Token")
	jwt := model.Blacklist{Jwt: token}
	if err := service.SetBlacklist(jwt); err != nil {
		fmt.Printf("jwt作废失败! error is :%s\n", err)
		response.FailWithMessage("jwt作废失败", c)
	} else {
		response.OkWithMessage("jwt作废成功", c)
	}
}
